package edu.jetwinner.util;

import java.lang.reflect.Array;

public final class EasyArrayUtil {

    private EasyArrayUtil() {
        // reserved.
    }

    public static boolean isArray(Object obj) {
        return obj != null && obj.getClass().isArray();
    }

    public static boolean isNotArray(Object obj) {
        return !isArray(obj);
    }

    public static boolean isNotEmpty(final Object[] array) {
        return getLength(array) != 0;
    }

    public static boolean isEmpty(final Object[] array) {
        return getLength(array) == 0;
    }

    public static int getLength(final Object array) {
        if (array == null) {
            return 0;
        }
        return Array.getLength(array);
    }
}
